#include"processBar.h"
#include<string.h>
#include<unistd.h>
const char *lable="|/-\\";

char bar[NUM];

#define GREEN "\033[0;32;32m"
#define NONE "\033[m"
void processbar(int rate)
{
    if(rate<0||rate>100) return ;
    int len =strlen(lable);
     printf("[%-100s]"NONE"[%d%%][%c]\r",bar,rate,lable[rate%len]);
     fflush(stdout);
     bar[rate++]=BOOY; 
     if(rate<100) bar[rate]=RIGHT;    
}

void initBar()
{
    memset(bar,'\0',sizeof(bar));
}
